Learning Python3 C2

Posted by Riino on

[TOC]

Panorama

This serious of problems are based on a sorted list (or linked list). Generally we need to make implementation of insert delete elements and combine.

insert is quite easy, in list it takes O(n), and in linked list it takes O(1), for example we insert an element in list[P]

i = len(list)-1
WHILE i > P
	list[i+1]=list[i] //move the array
	i--
list[i]=list[P]